package com.juc.threadPoolExecutor.threadPoolExecutor14;

import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class LinkedBlockingDequeTest3 {
	   //LinkedBlockingDeque使用无参构造
	   //max值被忽略
	   public static void main(String[] args) {
			LinkedBlockingDeque<Runnable> linked = new LinkedBlockingDeque<Runnable>();
			System.out.println(linked.size());
			ThreadPoolExecutor executor = new ThreadPoolExecutor(2, 3, 5, TimeUnit.SECONDS, linked);
			executor.execute(new MyRunnable());
			executor.execute(new MyRunnable());
			executor.execute(new MyRunnable());
			executor.execute(new MyRunnable());
			executor.execute(new MyRunnable());
			System.out.println(executor.getPoolSize() + "     " + linked.size());
			/**
			 *使用 new LinkedBlockingDeque<Runnable>();无参构造
			 *capacity 值Integer.MAX_VALUE
			 *源代码如下
			 * public LinkedBlockingDeque() {
                  this(Integer.MAX_VALUE);
               }
                        说明LinkedBlockingDeque对列
                        里面可以存 Integer.MAX_VALUE 个数据
                        放入队列3个任务，执行2个任务        
			 */
	  }     
}
